﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net;
using System.Net.Mail;

namespace WEEK14_上课演示
{
    public partial class SendMail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSendMail_Click(object sender, EventArgs e)
        {
            SmtpClient client = new SmtpClient("smtp.qq.com");
            client.Credentials = new NetworkCredential("11234387@qq.com", "liuxiaozeng"); //邮箱身份验证

            MailMessage mail = new MailMessage("11234387@qq.com",TextBox1.Text);
            mail.Subject = "test test";
            mail.Body = "body";
            mail.Attachments.Add(new Attachment("c:\\total.txt"));

            client.Send(mail);

            
        }
    }
}
